package com.antd.admin.api.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 系统日志
 * </p>
 *
 * @author 子丶沫
 * @since 2020-11-18
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("sys_log")
@ApiModel(value="SysLog对象", description="系统日志")
public class SysLog implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.ASSIGN_ID)
    private String id;

    @ApiModelProperty(value = "操作IP")
    @TableField("request_ip")
    private String requestIp;

    @ApiModelProperty(value = "操作类型 1 操作记录2异常记录")
    @TableField("type")
    private Integer type;

    @ApiModelProperty(value = "操作人")
    @TableField("user_name")
    private String userName;

    @ApiModelProperty(value = "操作描述")
    @TableField("description")
    private String description;

    @ApiModelProperty(value = "请求方法")
    @TableField("action_method")
    private String actionMethod;

    @TableField("action_url")
    private String actionUrl;

    @ApiModelProperty(value = "请求参数")
    @TableField("params")
    private String params;

    @ApiModelProperty(value = "浏览器")
    @TableField("ua")
    private String ua;

    @ApiModelProperty(value = "类路径")
    @TableField("class_path")
    private String classPath;

    @ApiModelProperty(value = "请求方法")
    @TableField("request_method")
    private String requestMethod;

    @ApiModelProperty(value = "操作类型")
    @TableField("operate_type")
    private String operateType;

    @ApiModelProperty(value = "开始时间")
    @TableField("start_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GTM+8")
    private LocalDateTime startTime;

    @ApiModelProperty(value = "完成时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GTM+8")
    @TableField("finish_time")
    private LocalDateTime finishTime;

    @ApiModelProperty(value = "消耗时间")
    @TableField("consuming_time")
    private Long consumingTime;

    @ApiModelProperty(value = "异常详情信息")
    @TableField("ex_desc")
    private String exDesc;

    @ApiModelProperty(value = "异常描述")
    @TableField("ex_detail")
    private String exDetail;

    @ApiModelProperty(value = "租户id")
    @TableField("tenant_id")
    private Integer tenantId;


}
